package com.gonsin.gview.common.bean;


import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.gitee.sunchenbin.mybatis.actable.annotation.Foreign;
import com.gitee.sunchenbin.mybatis.actable.annotation.TableComment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

import javax.persistence.*;


/**
 * 注册云会议的账号用户表 即会议管理员
 */
@Data
@ApiModel("用户信息UserBean")
@TableComment("账户信息")
@Entity
@Table(name = "gs_user")
@ToString
@TableName("gs_user")
public class UserBean extends BaseBean {

    private static final long serialVersionUID = -302769389062196452L;

    @Id
    @ApiModelProperty("主键")
    @TableId("user_key")
    @Column(name = "user_key", columnDefinition = "varchar(64) comment '主键'")
    private String userKey;

    @ApiModelProperty("用户名 即登录账号")
    @TableField("username")
//    @Unique
    @Column(name = "username", columnDefinition = "varchar(64) comment '用户名 即登录账号'", nullable = false)
    private String username; //用户名 即登录账号

    @JsonIgnore
    @ApiModelProperty("登录密码")
    @TableField("password")
    @Column(name = "password", columnDefinition = "varchar(64) comment '登录密码'", nullable = false)
    private String password;//登录密码

    @ApiModelProperty("真实姓名")
    @TableField("real_name")
    @Column(name = "real_name", columnDefinition = "varchar(64) comment '真实姓名'")
    private String realName;//真实姓名

    @JsonIgnore
    @TableField("salt")
    @ApiModelProperty(value = "盐值 用于加密时使用的摘要", hidden = true)
    @Column(name = "salt", columnDefinition = "varchar(64) comment '盐值 用于加密时使用的摘要'")
    private String salt; //盐值 用于加密时使用的摘要

//    @Transient
//    @JsonIgnore
//    @Deprecated
//    @ApiModelProperty("用户类型分三种最高(1) 次级(0) 普通(2)")
//    @Column(name = "type", columnDefinition = "int comment '用户类型分三种最高(1) 次级(0) 普通(2)'")
//    private Byte type;//用户类型分三种最高(1) 次级(0) 普通(2)

    @TableField("parent_user_key")
    @ApiModelProperty(value = "指向账号是被谁分配的", example = "1")
    @Column(name = "parent_user_key", columnDefinition = "varchar(64) comment '指向账号是被谁分配的'")
    private String parentUserKey;//指向账号是被谁分配的

    /**
     * @deprecated S09版本开始此字段没有用
     */
    @Deprecated
    @TableField("state")
    @ApiModelProperty(value = "账号状态 冻结(0) 解冻(1) 设置为删除(2)", example = "1")
    @Column(name = "state", columnDefinition = "int comment '账号状态 冻结(0) 解冻(1) 设置为删除(2)'")
    private Byte state;//账号状态 冻结(0) 解冻(1) 设置为删除(2)

//    /**
//     * @deprecated S09版本开始此字段没有用
//     */
//    @Deprecated
//    @ApiModelProperty(value = "是否已经绑定邮箱", example = "true")
//    @Column(name = "is_bind_email", columnDefinition = "tinyint comment '是否已经绑定邮箱'")
//    private Boolean bindEmail;//是否已经绑定邮箱

    @TableField("language")
    @ApiModelProperty(value = "用户选择的语言", example = "zh-CN")
    @Column(name = "language", columnDefinition = "varchar(64) comment '用户选择的语言'")
    private String language;//用户选择的语言

    @ApiModelProperty("皮肤")
    @Column(name = "skin", columnDefinition = "varchar(64) comment '皮肤'")
    private String skin;//皮肤

    @ApiModelProperty(value = "子账号数量", example = "0")
    @TableField("child_num")
    @Column(name = "child_num", columnDefinition = "int comment '子账号数量'")
    private Integer childNum;//子账号数量

    @ApiModelProperty(value = "主账号的key", example = "1")
    @TableField("root_user_key")
    @Column(name = "root_user_key", columnDefinition = "varchar(64) comment '主账号的key'")
    private String rootUserKey;            // 主账号的id

    /**
     * @deprecated 用userType 代替
     */
    @ApiModelProperty("是否管理员)")
    @TableField("is_admin")
    @Deprecated
    @Column(name = "is_admin", columnDefinition = "tinyint comment '是否管理员'")
    private Boolean admin = false;

    /**
     * @deprecated 用userType 代替
     */
    @ApiModelProperty("是否根管理员)")
    @TableField("is_root")
    @Deprecated
    @Column(name = "is_root", columnDefinition = "tinyint comment '是否根管理员'")
    private Boolean root = false;

    @ApiModelProperty("是否内外人员;0内部;1外部")
    @TableField("people")
    @Column(name = "people", columnDefinition = "tinyint comment '是否内外人员;0内部;1外部'")
    private Boolean people;

    @ApiModelProperty("是否绑定了人员资料（如果没有绑定则为空）")
    @TableField("user_message_key")
    @Column(name = "user_message_key", columnDefinition = "varchar(64) comment '是否绑定了人员资料（如果没有绑定则为空）'")
    private String userMessageKey;

    @ApiModelProperty("绑定的部门（如果没有绑定则为空）")
    @TableField("department_key")
    @Column(name = "department_key", columnDefinition = "varchar(64) comment '绑定的部门（如果没有绑定则为空）'")
    private String departmentKey;

    @ApiModelProperty("默认审批员")
    @TableField("default_audit")
    @Column(name = "default_audit", columnDefinition = "tinyint(1) comment '默认审批员'")
    private Boolean defaultAudit;

    @ApiModelProperty("绑定用户后，所属的userKey")
    @Column(name = "origin_user_key", columnDefinition = "varchar(64) comment '绑定用户后，所属的userKey'")
    @TableField("origin_user_key")
    private String originUserKey;

    @Column(name = "login_id", columnDefinition = "varchar(64) comment '泛微OA的login_id'")
    @TableField("login_id")
    @ApiModelProperty("泛微OA的login_id")
    private String loginId;

    @ApiModelProperty("备注")
    @TableField("remark")
    @Column(name = "remark", columnDefinition = "varchar(64) comment '备注'")
    private String remark;

    /**
     * @deprecated 用userType 代替
     */
    @ApiModelProperty(value = "是否为软件组", hidden = true)
    @TableField("soft")
    @JsonIgnore
    @Deprecated
    @Column(name = "soft", columnDefinition = "tinyint comment '是否为软件组'")
    private Boolean soft;

    @ApiModelProperty(value = "账号类型", hidden = true)
    @TableField("user_type")
    @Column(name = "user_type", columnDefinition = "varchar(16) default 'normal' comment '账号类型'")
    private String userType;

    /**
     * 外部资源，例如OA\DINGDING\企业微信等
     * 账号从外部资源同步过来之后，为了判断是否同一个实体，需要把外部的主键一同存入本系统
     */
    @ApiModelProperty(value = "外部资源的主键", hidden = true)
    @TableField("out_id")
    @JsonIgnore
    @Column(name = "out_id", columnDefinition = "varchar(16) default 'normal' comment '账号类型'")
    private String outId;

}

